From 022d4ee27cee157949ab70c928cbf77d8cda0e3b Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Mon, 25 Nov 2013 11:05:48 +0000 Subject: [PATCH] tools/xenctx: Prevent leaking a file handle on error paths Coverity ID: 1126110 Signed-off-by: Andrew Cooper CC: Ian Campbell Acked-by: Ian Jackson --- tools/xentrace/xenctx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c index 57e3277652..ba502fd5dc 100644 --- a/tools/xentrace/xenctx.c +++ b/tools/xentrace/xenctx.c @@ -208,13 +208,16 @@ static void read_symbol_table(const char *symtab) continue; default: symbol = malloc(sizeof(*symbol)); - if (symbol == NULL) + if (symbol == NULL) { + fclose(f); return; + } symbol->address = address; symbol->name = strdup(p); if (symbol->name == NULL) { free(symbol); + fclose(f); return; } -- 2.30.2